package com.hx.myblog3.repository;

import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.hx.myblog3.entity.Article;
import com.hx.myblog3.entity.ArticleType;

public interface ArticleRepo extends CrudRepository<Article, Integer>{
     Page<Article> findAll(Pageable pageable);
     Page<Article> findByAtype(ArticleType at,Pageable pageable);
     @Query("select a.id as id,a.title as title,a.createTime as createTime,"
     		+ "a.browsers as browsers,a.likes as likes,a.abstrct as abstrct,"
     		+ "a.atype.name as type from tb_article a")
     List<Map<String, Object>> allArticle();
}
